<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <style>
        .father{
            width: 200px;
            height: 200px;
            background: #f60;
        }
        .child{
            width: 100px;
            height: 100px;
            background: #0f6;
        }
    </style>
    <div class="father">
        <div class="child"></div>
    </div>

    <script>
        
        let father = document.getElementsByClassName('father')[0]
        let child = document.getElementsByClassName('child')[0]

        father.addEventListener('click', (e)=>{
            console.log('father冒泡')
        }, false)
        child.addEventListener('click', (e)=>{
            console.log('child目标1')
        }, false)
        window.addEventListener('click', (e)=>{
            console.log('window冒泡')
        }, false)
        document.addEventListener('click', (e)=>{
            console.log('document冒泡')
        }, false)
        document.documentElement.addEventListener('click', (e)=>{
            console.log('document.documentElement冒泡')
        }, false)
        document.body.addEventListener('click', (e)=>{
            console.log('document.body冒泡')
        }, false)

        //捕获
        father.addEventListener('click', (e)=>{
            console.log('father捕获')
        }, true)
        child.addEventListener('click', (e)=>{
            console.log('child目标2')
        }, true)
        window.addEventListener('click', (e)=>{
            console.log('window捕获')
        }, true)
        document.addEventListener('click', (e)=>{
            console.log('document捕获')
        }, true)
        document.documentElement.addEventListener('click', (e)=>{
            console.log('document.documentElement捕获')
        }, true)
        document.body.addEventListener('click', (e)=>{
            console.log('document.body捕获')
        }, true)

    </script>
</body>
</html>